package org.tloss.web.editor.model;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;

import org.tloss.web.editor.database.editors.jdbc.Column;
import org.tloss.web.editor.database.editors.jdbc.Table;

public class Orderby {
	private Table table;
	private Column column;
	private String order;
	
	public Orderby() {
	}
	

	public Orderby(Table table, Column column, String order) {
		super();
		this.table = table;
		this.column = column;
		this.order = order;
	}


	@XmlElement
	public Table getTable() {
		return table;
	}

	public void setTable(Table table) {
		this.table = table;
	}

	@XmlElement
	public Column getColumn() {
		return column;
	}

	public void setColumn(Column column) {
		this.column = column;
	}

	@XmlAttribute
	public String getOrder() {
		return order;
	}

	public void setOrder(String order) {
		this.order = order;
	}

	public String toString() {
		StringBuffer buffer = new StringBuffer();
		if (table != null) {
			buffer.append(table.getTableName());
		}
		buffer.append(".");
		if (column != null) {
			buffer.append(column.getColumnName());
		}
		return buffer.toString();
	}
}
